DROP TABLE emp;
DROP TABLE emp1;
DROP TABLE dept;
DROP TABLE dept1;
DROP TABLE dept2;
DROP TABLE dept3;
DROP TABLE dept4;
DROP TABLE dept4;
CREATE TABLE emp (  empno number,  ename varchar2(20),  sal number,  deptno number,  zip number);
CREATE TABLE emp1 (  empno number,  ename varchar2(20),  sal number,  deptno number,  zip number);
CREATE TABLE dept (  deptno number,  dname varchar2(20),  loc varchar2(20));
CREATE TABLE dept1 (  deptno number,  dname varchar2(20),  loc varchar2(20));
CREATE TABLE dept2 (  deptno number,  dname varchar2(20),  loc varchar2(20));
CREATE TABLE dept3 (  deptno number,  dname varchar2(20),  loc varchar2(20));
CREATE TABLE dept4 (  deptno number,  dname varchar2(20),  loc varchar2(20));
CREATE TABLE dept4 (  deptno number,  dname varchar2(20),  loc varchar2(20));
INSERT INTO emp (empno, ename, sal, deptno) VALUES  (999 + 100, 'phil', 10000, 10) ;
INSERT INTO emp1 (empno, ename, sal, deptno, zip) VALUES  (888 + 200, 'rita', 10000, 30, 78733) ;
for i in [1, 2, 3]:
   INSERT INTO emp (empno, ename, sal, deptno) VALUES  (i + 100, 'phil', 10000, 10) ;
   INSERT INTO emp1 (empno, ename, sal, deptno, zip) VALUES  (i + 200, 'rita', 10000, 30, 78733) ;
   INSERT INTO dept (deptno, dname, loc) VALUES (10, 'ACCOUNTING', 'NEW YORK') ;
   INSERT INTO dept1 (deptno, dname, loc) VALUES (20, 'RESEARCH', 'DALLAS') ;
   INSERT INTO dept2 (deptno, dname, loc) VALUES (30, 'SALES', 'CHICAGO') ;
   INSERT INTO dept3 (deptno, dname, loc) VALUES (40, 'OPERATIONS', 'BOSTON') ;
   INSERT INTO dept4 (deptno, dname) VALUES (50, 'MARKETING') ;
   print i;

for i in [1, 2, 3]:
   INSERT INTO emp (empno, ename, sal, deptno) VALUES  (i + 100, 'phil', 10000, 10) ;
   INSERT INTO emp (empno, ename, sal, deptno, zip) VALUES  (i + 200, 'rita', 10000, 30, 78733) ;
   INSERT INTO dept (deptno, dname, loc) VALUES (10, 'ACCOUNTING', 'NEW YORK') ;
   INSERT INTO dept (deptno, dname, loc) VALUES (20, 'RESEARCH', 'DALLAS') ;
   INSERT INTO dept (deptno, dname, loc) VALUES (30, 'SALES', 'CHICAGO') ;
   INSERT INTO dept (deptno, dname, loc) VALUES (40, 'OPERATIONS', 'BOSTON') ;
   INSERT INTO dept (deptno, dname) VALUES (50, 'MARKETING') ;
   print i;


ALTER TABLE emp ADD salary number(6);
print SELECT * FROM emp;
ALTER TABLE emp RENAME COLUMN salary TO salaryRenamed;
print SELECT * FROM emp;
DELETE FROM emp WHERE empno=100+1;
print SELECT * FROM emp;
INSERT INTO emp (empno, ename, sal, deptno) VALUES  (999 + 100, 'phil', 10000, 10) ;
print SELECT * FROM emp;
UPDATE emp SET ename = 'notSoRocking' WHERE deptno = 10;
print SELECT * FROM emp;
x = 3
y = 10
z=(lambda x: x*2)(x) + 4
print SELECT empno FROM emp WHERE deptno = y ;
print SELECT * FROM emp;

print SELECT empno FROM emp WHERE deptno < (lambda x: x*2)(x) + 4 OR ename = 'phil' AND ename = 'phil' ;

for i in [1, 2, 3]:
   print SELECT empno, sal, deptno FROM emp WHERE deptno < (lambda x: x*2)(x) + 4 OR ename = 'phil' AND deptno = i * 10 ;
   print SELECT * FROM emp WHERE deptno < (lambda x: x*2)(x) + 4 OR ename = 'phil' AND deptno = i * 10 ;
   print SELECT * FROM emp WHERE deptno = i * 10 ;
   print i
print "not query result:", UPDATE emp SET ename = 'notSoRocking' WHERE deptno = 10;   
x=SELECT * FROM EMP WHERE deptno = 2;
y=SELECT * FROM EMP WHERE zip = 78563;
z=SELECT * FROM EMP;
print "x=",x
print "y=",y
print "z=",z
print "list(z)=",list(z)
